package com.mall.common.exception;

import com.mall.common.result.ResultCode;

/**
 * 用户相关业务异常
 */
public class UserException extends BusinessException {
    
    public UserException(String message) {
        super(ResultCode.USER_NOT_EXIST, message);
    }
    
    public UserException(ResultCode resultCode, String message) {
        super(resultCode, message);
    }
    
    public static UserException userNotFound() {
        return new UserException(ResultCode.USER_NOT_EXIST, "用户不存在");
    }
    
    public static UserException usernameExists() {
        return new UserException(ResultCode.CONFLICT, "用户名已存在");
    }
    
    public static UserException emailExists() {
        return new UserException(ResultCode.CONFLICT, "邮箱已被注册");
    }
    
    public static UserException passwordError() {
        return new UserException(ResultCode.UNAUTHORIZED, "用户名或密码错误");
    }
    
    public static UserException accountDisabled() {
        return new UserException(ResultCode.FORBIDDEN, "账号已被禁用");
    }
} 